/*
 * ColorRenderer.java
 *
 * Created on December 13, 2007, 12:10 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.fie.renderer;

import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.*;
import java.awt.*;
 
public class ColorRenderer
  extends DefaultTableCellRenderer
{
  private int columns;
	
  public ColorRenderer(int col)
  {
    columns = col;
  }
	
  public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column){
        setText(String.valueOf(value));
        
            
                    Object objValue = table.getValueAt(row, columns);
                if (objValue != "" && String.valueOf(objValue).indexOf("+")>=0){
                    //System.out.println(objValue+" ---- > "+columns);
                   setBackground(Color.GREEN);
                   return (this);
                }
            
        
        this.setBackground(Color.RED); // All columns verified were empty - set our background RED
        return this;
        }
}